-
-
Notifications
You must be signed in to change notification settings - Fork 195
Glasgow | ITP May -25 | Pandi Simatupang | Module-Structuring-and-Testing-Data | coursework/sprint-2 #650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Glasgow | ITP May -25 | Pandi Simatupang | Module-Structuring-and-Testing-Data | coursework/sprint-2 #650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, there is a lot of excellent code here, and you can understand how a code will run before it has run.
@@ -1,13 +1,21 @@ | |||
// Predict and explain first... | |||
// =============> write your prediction here | |||
//the function will turn the first given string into Uppercase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//the function will turn the first given string into Uppercase. | |
//the function will turn the first character of a given string into Uppercase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For information/reference, when declaring a function we call these parameters, when we call the function we call them arguments. It is a subtle distinction but is important to remember especially when communicating with other developers.
|
||
// =============> write your explanation here | ||
//function will execute line the code and escape from the function block whenever it "sees" return.. it will return with any expression put on it | ||
// in this function a+b which is expected as the result is placed after return line because return has ";" so i wont bother look the next line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is important to note that ;
[semicolon] is not needed in this case for the function to return when it reaches the return
statement. New line is also a valid way to end the line, thus the function will not execute a + b
even if we were missing a ;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap your code into a function that is then called with the argument "hello world I am sleepy"
?
Learners, PR Template
Self checklist
Changelist
Answers and comments to Sprint-2.
Questions
Null